package com.chixing.controller;

import com.chixing.service.CarService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CarAjaxController {
    @Autowired
    private CarService carService;
    @GetMapping(value = {"ajax/car","ajax/car/page/{pageNum}"})
    @ResponseBody
    public ServerResponse getByPage(@PathVariable(value = "pageNum",required = false) Integer pageNum){

        if (pageNum==null)
            pageNum =1;

            return carService.getByPage(pageNum);

    }
}
